package com.course_design.controller;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.course_design.entity.Student;
import com.course_design.service.StudentService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;

@Controller
public class StudentController {
	@Autowired
	private StudentService studentService;
	@RequestMapping("/updateStudent")
	@ResponseBody
	public Msg updateStudent(@RequestParam(value="studentNum")String[] studentNums
			,@RequestParam(value="ruleId")Integer ruleId,@RequestParam("classId")Integer classId) {
		studentService.updateStudent(studentNums,ruleId,classId);
		return Msg.success("OK");
	}
	@RequestMapping("/queryAllStudentWithClass")
	@ResponseBody
	public Msg queryAllStudentWithClass(@RequestParam("classId")Integer classId,@RequestParam(value="pn",defaultValue="1")Integer pn) {
		PageInfo<Student> students=studentService.queryAllStudentWithClass(classId,pn,10);
		return Msg.success("OK").add("pageInfo", students);
	}
}
